package main

import (
	"context"
	"fmt"
	"gitee.com/kaylee595/gretry/v2"
	"io"
	"net/http"
)

func main() {
	resp, err := gretry.DoWithValue(context.Background(),
		func(ctx context.Context) (*http.Response, error) {
			return http.Get("https://www.google.com")
		},
	)
	if err != nil {
		panic(err)
	}
	defer resp.Body.Close()
	body, err := io.ReadAll(resp.Body)
	if err != nil {
		panic(err)
	}
	fmt.Println(string(body))
}
